﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lg.Core
{
    public class LongJsonConvert : JsonConverter<long>
    {
        public override long ReadJson(JsonReader reader, Type objectType, long existingValue, bool hasExistingValue, JsonSerializer serializer)
        {
            Log.Debug("readJson", reader.Value?.ToString()??"");
            return Convert.ToInt64(reader.Value);
        }

        public override void WriteJson(JsonWriter writer, long value, JsonSerializer serializer)
        {
            Log.Debug("writeJson", value.ToString() ?? "");
            writer.WriteValue(value.ToString());
        }
    }  
}
